/**
 * Copyright [2010] Delta Air Lines, Inc. All Rights Reserved Access,
 * Modification, or Use Prohibited Without Express Permission of Delta Air
 * Lines.
 */
package com.delta.rafg.coredata;

/**
 * @author RAFG Development Team (D9785692)
 */
public abstract class ARequest extends ClientData {

	/**
	 * Holds the value of serialVersionUID property.
	 */
	private static final long serialVersionUID = -1743223629524101757L;

	/**
	 * Holds the value of agentRole property.
	 */
	private String            agentRole;

	private String            sessionID;

	/*
	 * A Unique identifier for this place.This identifier is used to inspect the
	 * session held by this place for request processing.
	 */
	private String            systemID;

	// the user password required for generating session ids.
	private String            password;

	/**
	 * This is a constructor of ARequest.java
	 * @deprecated use ARequest(String pAgentId, String pAgentCity, String pAgentRole, pHttpRequest)
	 */
	public ARequest(){

		super("", "", "", "", "", "");
	}

	/**
	 * Used to construct a request for in subsequent calls. i.e when a business
	 * process calls a service.
	 * 
	 * @param pRequest
	 * @deprecated use ARequest(String pAgentId, String pAgentCity, String pAgentRole, pHttpRequest)
	 */
	public ARequest(final ARequest pRequest){

		super(pRequest);
	}

	/**
	 * This is a constructor of ARequest.java
	 * 
	 * @param pAgentId
	 * @param pAgentCity
	 * @param pAgentRole
	 * @deprecated use ARequest(String pAgentId, String pAgentCity, String pAgentRole, pHttpRequest)
	 */
	public ARequest(final String pAgentId, final String pAgentCity,
	    final String pAgentRole){

		super("", "", "", "", "", "");
		setUserData(pAgentId, pAgentCity, pAgentRole);
	}

	/**
	 * Used to construct a request for the first time. i.e in the initial entry
	 * point, usually a business process. Please note that a session key is
	 * generated the first time. and propagated all along.
	 * 
	 * @param pAgentId
	 * @param pAgentWorkstation
	 * @param pAgentBrowser
	 * @param pAgentCity
	 * @param pBusinessProcess
	 * @param pWebSessionId
	 * @deprecated use ARequest(String pAgentId, String pAgentCity, String pAgentRole, pHttpRequest)
	 */
	public ARequest(final String pAgentId, final String pAgentWorkstation,
	    final String pAgentBrowser, final String pAgentCity,
	    final String pBusinessProcess, final String pWebSessionId){

		super(pAgentId, pAgentWorkstation, pAgentBrowser, pAgentCity,
		    pBusinessProcess, pWebSessionId);
	}


	/**
	 * This is a constructor of ARequest.java
	 * 
	 * @param pAgentId
	 * @param pAgentCity
	 * @param pAgentRole
	 */
	public ARequest(final String pAgentId, final String pAgentCity,
	    final String pAgentRole, Object pHttpRequest){

		super("", "", "", "", "", "");
		setUserData(pAgentId, pAgentCity, pAgentRole);
		getaObj().setHttpData(this, pHttpRequest);
	}	

	/**
	 * This method is the access method for the <code>agentRole</code> property,
	 * which is of type <code>String</code>.
	 * 
	 * @return String the current value of the <code>agentRole}</code> property.
	 */
	public String getAgentRole() {

		return agentRole;
	}

	public String getSessionID() {

		return sessionID;
	}

	/**
	 * @return the systemID
	 */
	public String getSystemID() {
		return systemID;
	}

	/**
	 * This method sets the value of the <code>agentRole</code> property, which
	 * is of type <code>${field_type}</code>.
	 * 
	 * @param agentRole
	 *            - the new value of <code>agentRole</code> property.
	 */
	public void setAgentRole(final String agentRole) {

		this.agentRole = agentRole;
	}

	public void setHttpData(final String pBrowser, final String pDeviceId,
	    final String pSessionId, final String pLocale) {

		setAgentBrowser(pBrowser);
		setAgentDeviceId(pDeviceId);
		setClientSessionId(pSessionId);
		setLocale(pLocale);
		generateServerSessionKey();
	}

	public void setSessionID(String sessionID) {

		this.sessionID = sessionID;
	}

	/**
	 * @param systemID
	 *            the systemID to set
	 */
	public void setSystemID(String systemID) {
		this.systemID = systemID;
	}

	/**
	 * This method is used for setting user related data into the filed.
	 * 
	 * @param pAgentId
	 * @param pAgentCity
	 * @param pAgentRole
	 */
	public void setUserData(final String pAgentId, final String pAgentCity,
	    final String pAgentRole) {

		setAgentId(pAgentId);
		setAgentCity(pAgentCity);
		setAgentRole(pAgentRole);
	}

	/**
     * @param password the password to set
     */
    public void setPassword(String password) {
	    this.password = password;
    }

	/**
     * @return the password
     */
    public String getPassword() {
	    return password;
    }

}
